<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8"%>
<!DOCTYPE html>
<html>
<head>
    <meta charset="utf-8">
    <title>分类列表</title>
    <link rel="stylesheet" href="${pageContext.request.contextPath}/layui/css/layui.css">
</head>
<body class="layui-layout-body">
<div class="layui-layout layui-layout-admin">
    <div class="layui-header">
        <div class="layui-logo">快播平台</div>
        <ul class="layui-nav layui-layout-right">
            <li class="layui-nav-item"><a href="../../login.jsp">注销</a></li>
        </ul>
    </div>
    <div class="layui-side layui-bg-black">
        <div class="layui-side-scroll">
            <ul id="videoTable" class="layui-nav layui-nav-tree"></ul>
        </div>
    </div>

    <div class="layui-body">
        <iframe name="type" frameborder="0" width="100%" height="100%" scrolling="no"></iframe>
    </div>
</div>
    <script src="${pageContext.request.contextPath}/js/jquery.min.js"></script>
    <script src="${pageContext.request.contextPath}/layui/layui.js"></script>
    <script type="text/javascript">
        layui.use(['element','jquery'], function(){
            var element = layui.element,
                $ = layui.jquery;
        });
        $(function(){
            loadType();
        });

        function loadType(){
            $.ajax({
                type:"post",
                url:"${pageContext.request.contextPath}/selectAllType.do",
                data:{},
                dataType:"json",
                success:function(result){
                    if(result.status){
                        $("#videoTable").empty();
                        var list = result.data;
                        var html = '';
                        html+='<li class="layui-nav-item"><a href="userInformation.jsp" target="blank">个人中心</a></li>';
                        html+='<li class="layui-nav-item"><a href="recharge.jsp" target="blank">充值会员</a></li>';
                        for(var i = 0;i < list.length;i++){
                            html += '<li class="layui-nav-item"><a href="videoTables.jsp?tid='+list[i].tId+'" target="type">'+list[i].tName+'</a></li>';
                        }
                        $("#videoTable").append(html);
                    }else{
                        alert(result.message);
                    }
                }
            });
        }
    </script>
</body>
</html>